package com.zd.kids.ui.view;

import android.content.Context;
import android.content.Intent;

import com.blankj.utilcode.util.ToastUtils;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.core.BottomPopupView;
import com.zd.kids.R;
import com.zd.kids.ui.activity.JoinClassComputerActivity;

import androidx.annotation.NonNull;

/**
 * @ClassName: com.zd.kids.ui.view
 * @Description:
 * @Author: hyy
 * @Date: 2020/6/19
 * @Time: 10:21 AM
 */
public class SelectPicTypePopupWindow extends BottomPopupView {
    Context context;

    public SelectPicTypePopupWindow(@NonNull Context context, SelectPicCallBack selectPicCallBack) {
        super(context);
        this.context = context;
        this.selectPicCallBack = selectPicCallBack;
    }


    @Override
    protected void init() {
        super.init();

        findViewById(R.id.tv_cameral).setOnClickListener(view -> {
            selectPicCallBack.selectCamera();
            dismiss();
        });

        findViewById(R.id.tv_album).setOnClickListener(view -> {
            selectPicCallBack.selectAlbum();
            dismiss();
        });

        findViewById(R.id.tv_close).setOnClickListener(view -> {
            dismiss();
        });

    }

    @Override
    protected int getImplLayoutId() {
        return R.layout.layout_select_pic_type;
    }


    public void showView() {
        new XPopup.Builder(getContext())
                .dismissOnTouchOutside(false)
                .asCustom(this)
                .show();
    }

    SelectPicCallBack selectPicCallBack;

    public interface SelectPicCallBack {

        void selectAlbum();

        void selectCamera();

    }
}
